package veda;

import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSON;
import com.example.eeuse.model.FareResult;
import com.example.eeuse.util.FareRespose;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class FareComp {
    public static void main(String[] args) {
        String respStr1= FileUtil.readString("D:\\test\\基础快照票价.txt","utf-8");
        FareRespose fareRespose1= JSON.parseObject(respStr1,FareRespose.class);
        String respStr2= FileUtil.readString("D:\\test\\加额外Session票价.txt","utf-8");
        FareRespose fareRespose2= JSON.parseObject(respStr2,FareRespose.class);
        Map<String,FareResult.FareXx> rMap1= fareRespose1.getResponse().getResponseStruc().getFareSrAr().getFareXxList().stream().filter(v->v.getDepartureClass().equals("R")).collect(Collectors.toMap(v->v.getFareReference(), v->v));
        Map<String,FareResult.FareXx> rMap2= fareRespose2.getResponse().getResponseStruc().getFareSrAr().getFareXxList().stream().filter(v->v.getDepartureClass().equals("R")).collect(Collectors.toMap(v->v.getFareReference(), v->v));
        rMap2.forEach((k,v)->{
            FareResult.FareXx fareXx=rMap1.get(k);
            if(fareXx==null)
            {
                System.out.println("null:"+k);
            }
            else {
                System.out.println("has1:"+fareXx.getFareReference());
            }
        });
        System.out.println();

    }
}
